#!/bin/bash


IP=127.0.0.1
#IP=192.168.0.8
PORT=5432

for fn in {1,4,50}M
do
    FILENAME=$fn.plot
    for bs in `seq 16`
    do
        SOMA=0
        BUFSIZE=`echo 2^$bs | bc`
        for n in `seq 100`
        do
            TAXA=$(./cliente $IP $PORT $fn $BUFSIZE | tail -n 1)
            SOMA=`echo $SOMA + $TAXA | bc`
            echo $bs $TAXA
            echo $bs $TAXA >> $FILENAME
        done
        MEDIA=`echo $SOMA / 100 | bc`
        echo $bs $MEDIA
        echo $bs $MEDIA >> avg.$FILENAME
    done
done
